<template>
	<div class='app-container'>
		<div class='policynumber'>
			<div class='policynumber-tab'>
				<div class='tab-con'>
					<span class='active'>按保单号登记</span>
					<span @click='toPolicynumber'>批量登记</span>
					<span @click='toExcel'>Excel表格导入</span>
					<span @click='toPolicyhistory'>保单导入历史</span>
				</div>
			</div>
			<div class='contentin'>
				<el-form :model="copyinfo" :rules="rules" ref="copyinfo" label-width="100px" class="demo-ruleForm">
					<div class="ruleFormout">
						<el-form-item class="informationaa" label="保险公司:" prop="insuranceId">
							<el-select class="selects" size="mini" v-model="copyinfo.insuranceId" placeholder="请选择保险公司" @change="changecomony(copyinfo.insuranceId)">
								<el-option-group v-for="group in options" :key="group.letter" :label="group.letter">
									<el-option v-for="item in group.insurances" :key="item.id" :label="item.insuranceName" :value="item.id">
									</el-option>
								</el-option-group>
							</el-select>
						</el-form-item>
						<el-form-item class="informationaa" label="工　号:" prop="staffId">
							<el-select class="selects" size="mini" v-model="copyinfo.staffId" placeholder="请选择">
								<el-option class="selects" v-for="item in workoptions" :key="item.id" :label="item.staffAccount" :value="item.id">
								</el-option>
							</el-select>
						</el-form-item>

						<el-form-item class="informationaa" label="组织机构" prop="OrganizationUnitId">
							<ztree-select placeholder="请选择组织" @change="setSelectedId" class='selects' v-model="copyinfo.OrganizationUnitId" :multiple="false" :treedata="treedata" :childprops="treeProps"></ztree-select>
							
						</el-form-item>
						<el-form-item class="informationaa setStyle" label="业务归属"  prop="businessOrganzationId">
							<el-select v-model="copyinfo.businessOrganzationId" filterable placeholder="请选择" size="mini" class='selects'>
								<el-option style="padding:0 7px;" v-for="item in userlist" :key="item.organzationId" :label="item.organzationName" :value="item.organzationId">
								</el-option>
							</el-select>
						</el-form-item>

						<el-form-item class="informationaa setStyle" label="业务员">
							
							<el-input class='selects' v-model="copyinfo.salesman" placeholder="请选择业务员" size="mini"></el-input>
						</el-form-item>
						<el-form-item class="informationaa" label="保单号:" prop="guaranteeSlipNumber">
							<el-input v-model="copyinfo.guaranteeSlipNumber" class="selects" size="mini" placeholder="请输入保单号"></el-input>
						</el-form-item>
					</div>

					<el-button :loading="loading1" type="primary" size="small" class="btn" @click="btn('copyinfo')">查询</el-button>

				</el-form>
				<div class="contentdemo" v-if="isshows">
					<div class="contentdemoin">
						<div class="content_left">
							<div class="scrollcontent">
								<div class="titles" ref="titles_text">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 保单信息
									</p>

								</div>
								<div class="Policy">
									<div class="Policy_top">
										<span class="Policy_top_name">保单号：</span>
										<span class="Policy_top_num">
								{{allData.guaranteeSlipNumber}}
							</span>
										<span class="Policy_top_types" v-if='allData.guaranteeSlipType==1'>商业险
							</span>
										<span class="Policy_top_type2" v-else>交强险</span>
									</div>
									<div class="Policy_conebt">
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">保险公司：</span>
												<span class="Policy_conebt_dir">{{allData.insuranceName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">工&emsp;&emsp;号：</span>
												<span class="Policy_conebt_dir">{{allData.staffAccount}} （{{allData.describe}}）
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">业务归属：</span>
												<span class="Policy_conebt_dir">{{allData.names}}
									</span>
											</p>
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">业&ensp;务&ensp;员：</span>
												<span class="Policy_conebt_dir">{{allData.salesman}}
												</span>

											</p>
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">总&ensp;保&ensp;费：</span>
												<span class="Policy_conebt_dir Policy_conebt_money">￥{{allData.totalPremium | numFilter}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">总标准保费：</span>
												<span class="Policy_conebt_dir">￥{{allData.totalStandardPremium | numFilter}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">总净保费：</span>
												<span class="Policy_conebt_dir Policy_conebt_money">￥{{allData.totalNetPremium | numFilter}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">总&ensp;税&ensp;额：</span>
												<span class="Policy_conebt_dir">￥{{allData.totalTaxAmount | numFilter}}
								</span>
											</p>

											<p class="Policy_conebt_one" v-if='allData.guaranteeSlipType==2'>
												<span class="Policy_conebt_name">车&ensp;船&ensp;税：</span>
												<span class="Policy_conebt_dir">{{allData.vehicleAndVesselTax | numFilter}}
									
								</span>
											</p>

											<p class="Policy_conebt_one" v-if='allData.guaranteeSlipType==2'>
												<span class="Policy_conebt_name">车船税状态：</span>
												<span class="Policy_conebt_dir">{{allData.taxTypeName}}
									
								</span>
											</p>
										</div>

										<!--2222-->
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">签单日期：</span>
												<span class="Policy_conebt_dir">{{allData.signDate}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">核保日期：</span>
												<span class="Policy_conebt_dir">{{allData.confirmDate}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">支付日期：</span>
												<span class="Policy_conebt_dir">{{allData.paymentDate}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">起保日期：</span>
												<span class="Policy_conebt_dir">{{allData.beginDate}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">到期日期：</span>
												<span class="Policy_conebt_dir">{{allData.expirationDate}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">录入系统日期：</span>
												<span class="Policy_conebt_dir">{{allData.creationTime}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">单证打印日期：</span>
												<span class="Policy_conebt_dir">{{allData.documentPrintingDate}}
								</span>
											</p>

											<p class="Policy_conebt_one" v-if='allData.guaranteeSlipType==2'>
												<span class="Policy_conebt_name">车船税补缴：</span>
												<span class="Policy_conebt_dir">{{allData.overPay | numFilter}}
									
								</span>
											</p>

											<p class="Policy_conebt_one" v-if='allData.guaranteeSlipType==2'>
												<span class="Policy_conebt_name">车船税滞纳金：</span>
												<span class="Policy_conebt_dir">{{allData.lateFree | numFilter}}
									
								</span>
											</p>

										</div>

										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">投保单号：</span>
												<span class="Policy_conebt_dir">{{allData.guaranteeSlipSingleNumber}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">保单印刷号：</span>
												<span class="Policy_conebt_dir">{{allData.guaranteeSlipPrintingNumber}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">业务类型：</span>
												<span class="Policy_conebt_dir">{{allData.businessTypeName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">交商同保：</span>
												<span class="Policy_conebt_dir">{{allData.insuranceTypeName}}
								</span>

												<!--<el-popover trigger="manual" placement="bottom-end" width="189" v-model="insuranceshow">
										<div class="insurance_radio">
											<p>交商同保：</p>
											<div class="insurance_radios">
												<el-radio v-model="radios" class="radio_lefdt" :label="item.key" v-for="item in mutualInsurances">{{item.value}}</el-radio>
											</div>
										</div>
										<div class="btns">
											<el-button size="mini" @click="insurancesubmits" :loading="loadings">确定</el-button>
											<el-button size="mini" type="info" @click="insuranceshow= false">取消</el-button>
										</div>
										<div slot="reference" class="color_text">{{allData.mutualInsurance}}
											<i class="iconfont icon-bianji" @click="editedituser(allData)"></i>
										</div>
									</el-popover>-->

											</p>
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">上年出险次数：</span>
												<span class="Policy_conebt_dir">{{allData.dangerTimes}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">上年违章次数：</span>
												<span class="Policy_conebt_dir">{{allData.peccancyTimes}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name">渠道名称：</span>
												<span class="Policy_conebt_dir">{{allData.channelName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name"> 渠道代码：</span>
												<span class="Policy_conebt_dir">{{allData.channelCode}}
								</span>
											</p>

											<p class="Policy_conebt_one" v-if='allData.guaranteeSlipType==2'>
												<span class="Policy_conebt_name"> 标志印刷号：</span>
												<span class="Policy_conebt_dir">{{allData.markPrintingNumber}}
								</span>
											</p>
										</div>
									</div>
								</div>

							</div>
							<!--2222-->
							<div class="scrollcontent">
								<div class="titles">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 车辆信息
									</p>
								</div>
								<div class="Policy">
									<div class="Policy_top">
										<span class="Policy_top_name">车牌号：</span>
										<span class="Policy_top_type Policy_top_car1" v-if="allData.plateColorName=='蓝'">
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
										<span class="Policy_top_type Policy_top_car2" v-else-if="allData.plateColorName=='黑'">
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
										<span class="Policy_top_type Policy_top_car3" v-else-if="allData.plateColorName=='白'">
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
										<span class="Policy_top_type Policy_top_car4" v-else-if="allData.plateColorName=='绿'">
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
										<span class="Policy_top_type Policy_top_car5" v-else-if="allData.plateColorName=='黄'">
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
										<span class="Policy_top_type Policy_top_car" v-else>
								<span>{{allData.plateNumber | addtrims}}
								</span>
										</span>
									</div>
									<div class="Policy_conebt">
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">车辆种类：</span>
												<span class="Policy_conebt_dir">{{allData.vehicleTypeName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">号牌底色：</span>
												<span class="Policy_conebt_dir">{{allData.plateColorName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">车&ensp;架&ensp;号：</span>
												<span class="Policy_conebt_dir">{{allData.frameNumber}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">发动机号：</span>
												<span class="Policy_conebt_dir">{{allData.engineNumber}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">座&emsp;&emsp;位：</span>
												<span class="Policy_conebt_dir">{{allData.seatCount}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">是否新车：</span>
												<span class="Policy_conebt_dir">{{allData.isNewName }}
								</span>
											</p>
										</div>

										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">采&ensp;购&ensp;价：</span>
												<span class="Policy_conebt_dir">{{allData.purchasePrice | numFilter}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">核载质量：</span>
												<span class="Policy_conebt_dir">{{allData.loadQuality}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">整备质量：</span>
												<span class="Policy_conebt_dir">{{allData.curbQuality}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">功&emsp;&emsp;率：</span>
												<span class="Policy_conebt_dir">{{allData.power}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">排&emsp;&emsp;量：</span>
												<span class="Policy_conebt_dir">{{allData.displacement}}
								</span>
											</p>
										</div>
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">厂牌型号：</span>
												<span class="Policy_conebt_dir">{{allData.brandModel}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">是否过户车：</span>
												<span class="Policy_conebt_dir">{{allData.isTransferName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">所属性质：</span>
												<span class="Policy_conebt_dir">{{allData.belongNatureName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">使用性质：</span>
												<span class="Policy_conebt_dir">{{allData.useNatureName }}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">初登日期：</span>
												<span class="Policy_conebt_dir">{{allData.initialDate | times}}
								</span>
											</p>
										</div>

									</div>
								</div>

							</div>

							<!--3333-->
							<div class="scrollcontent">
								<div class="titles">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 保单关系人
									</p>
								</div>
								<div class="Policy Policy_user Policy_arr">
									<template v-if="allData.guaranteeSlipRelations" v-for="(item,index) in allData.guaranteeSlipRelations">
										<div class="Policy_top">
											<span class="Policy_top_name">
									<span>{{item.str}} </span>

											</span>

										</div>
										<div class="Policy_conebt Policy_conebt_bom">
											<div class="Policy_conebt_left">
												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">客户姓名：</span>
													<span class="Policy_conebt_dir">{{item.customerName}}
										</span>
												</p>

												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">证件类型：</span>
													<span class="Policy_conebt_dir">{{item.certificateTypeName}}
								</span>
												</p>

												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">客户类型：</span>
													<span class="Policy_conebt_dir" v-if="item.customerType==0">个人客户</span>
													<span class="Policy_conebt_dir" v-else-if="item.customerType==1">集体客户</span>
													<span class="Policy_conebt_dir" v-else>-</span>
												</p>

											</div>

											<div class="Policy_conebt_left">
												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">性&emsp;&emsp;别：</span>
													<span class="Policy_conebt_dir" v-if="item.gender==0">男</span>
													<span class="Policy_conebt_dir" v-else-if="item.gender==1">女</span>
													<span class="Policy_conebt_dir" v-else>-</span>
												</p>

												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">证&ensp;件&ensp;号：</span>
													<span class="Policy_conebt_dir">{{item.identificationNumber}}
								</span>
												</p>

												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">地&emsp;&emsp;址：</span>
													<span class="Policy_conebt_dir">{{item.address}}
								</span>
												</p>
											</div>
											<div class="Policy_conebt_left">
												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">手&ensp;机&ensp;号：</span>
													<span class="Policy_conebt_dir">{{item.customerPhone}}
								</span>
												</p>

												<p class="Policy_conebt_one">
													<span class="Policy_conebt_name Policy_top_smallname">座&ensp;机&ensp;号：</span>
													<span class="Policy_conebt_dir">{{item.telphone}}
								</span>
												</p>
											</div>

										</div>
										<div class="jiange" v-if="index!=allData.guaranteeSlipRelations.length-1">

										</div>
									</template>

								</div>

							</div>

							<!--4444-->
							<div class="scrollcontent">
								<div class="titles">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 保单明细
									</p>
								</div>
								<div class="Policy Policy_arr Policy_boms">
									<div class="Policy_table Policycar">
										<div class="Policy_table_bor">
											<div class="Policy_table_top Policy_table_tops">
												<p class="Policy_table_one">项目</p>
												<p class="Policy_table_two Policy_table_twos">保额</p>
												<p class="Policy_table_three Policy_table_twos">保单保费</p>
												<p class="Policy_table_four Policy_table_twos">折扣</p>
											</div>
											<template v-if="allData.details" v-for="item in allData.details">
												<span class="Policy_details_name">
									<i class="iconfont icon-xuanzhong"></i>{{item.kindname}}
								</span>
												<div class="Policy_table_top" v-for="val in item.slipDetails">
													<p class="Policy_table_one">{{val.itemName}}</p>
													<p class="Policy_table_two Policy_table_twos">{{val.coverage | numFilter}}</p>
													<p class="Policy_table_three Policy_table_twos">{{val.premium | numFilter}}</p>
													<p class="Policy_table_four Policy_table_twos">{{val.discount}}</p>
												</div>
											</template>
											<div v-else class="nodata">
												暂无数据
											</div>
										</div>

									</div>
								</div>

							</div>

							<!--11 v-if="allData.extends"-->
							<div class="scrollcontent">
								<div class="titles">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 扩展信息
									</p>
								</div>
								<div class="Policy Policy_extends">
									<div class="extends" v-if="allData.guaranteeSlipAllExtends">
										<div class="extends_one" v-for="val in allData.guaranteeSlipAllExtends">
											<p class="Policy_extends_one">{{val.extendName}}</p>
											<p class="Policy_table_two">{{val.extendValue}}</p>
										</div>
									</div>
									<div class="nodata" v-else>
										暂无数据
									</div>
								</div>

							</div>

							<div class="scrollcontent">
								<div class="titles">
									<p class="title_name">
										<i class="iconfont icon-baoxianchanpin"></i> 代理信息
									</p>
								</div>
								<div class="Policy">
									<div class="Policy_top">
										<span class="Policy_top_name">出单机构：</span>
										<span class="Policy_top_num">
								<span>{{allData.dealInstitution}}
								</span>
										</span>
									</div>
									<div class="Policy_conebt">
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">归属机构：</span>
												<span class="Policy_conebt_dir">{{allData.belongToInstitution}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">归&ensp;属&ensp;人：</span>
												<span class="Policy_conebt_dir">{{allData.belonger}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">经&ensp;办&ensp;人：</span>
												<span class="Policy_conebt_dir">{{allData.agent}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">业务来源：</span>
												<span class="Policy_conebt_dir">{{allData.businessSources}}
								</span>
											</p>

										</div>

										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">验&ensp;车&ensp;人：</span>
												<span class="Policy_conebt_dir">{{allData.carChecker}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">子协议代码：</span>
												<span class="Policy_conebt_dir">{{allData.subProtocolCode}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">争议处理：</span>
												<span class="Policy_conebt_dir">{{allData.disputeSettlement}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">报&ensp;批&ensp;号：</span>
												<span class="Policy_conebt_dir">{{allData.batchNumber}}
								</span>
											</p>

										</div>
										<div class="Policy_conebt_left">
											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">报批名称：</span>
												<span class="Policy_conebt_dir">{{allData.batchName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">渠道类型：</span>
												<span class="Policy_conebt_dir">{{allData.channelTypeName}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">仲裁机构：</span>
												<span class="Policy_conebt_dir">{{allData.arbitrationInstitution}}
								</span>
											</p>

											<p class="Policy_conebt_one">
												<span class="Policy_conebt_name Policy_top_smallname">推荐修送点：</span>
												<span class="Policy_conebt_dir">{{allData.recommendedRepairPoint}}
								</span>
											</p>

										</div>

									</div>
								</div>

							</div>

						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="fixedbtn" v-if="isshows">
			<el-button size="mini" type="info" class="debtn" @click="benfalse">取消</el-button>
			<el-button size="mini" class="debtn" @click="btntrue" type="primary" :loading="btnloadings">确认登记</el-button>
									
		</div>
	</div>
</template>

<script>
	import Vue from 'vue'
	import ztreeSelect from "@/components/z-select/index.vue";
	export default {
		data() {
			return {
				loading1: false,
				isshows: false,
				btnloadings:false,
				id:"",
				copyinfo: {

				},
				allData: {},
				treeProps: {
					name: "displayName", //显示名字
					children: "orgs", //子级字段名
					lv: "depth" //当前层级
				}, //树属性
				treedata: [], //树数据
				userlist: [],
				options: [],
				workoptions: [],
				rules: {
					batchName: [{
						required: true,
						message: "请输入批次名称",
						trigger: "blur"
					}],
					insuranceId: [{
						required: true,
						message: "请选择保险公司",
						trigger: "change"
					}],
					staffId: [{
						required: true,
						message: "请选择适用工号",
						trigger: "change"
					}],
					guaranteeSlipNumber: [{
						required: true,
						message: "请填写保单号",
						trigger: "blur"
					}],
					OrganizationUnitId: [{
						required: true,
						message: "请选择组织机构",
						trigger: "change"
					}],
					businessOrganzationId: [{
						required: true,
						message: "请选择业务归属",
						trigger: "change"
					}],
				},

			}
		},
		mounted() {
			this.getcommoy()
			this.getUnits()

		},
		filters: {
			tofixeds(val){
				 val=val*100
				return val.toFixed(2)
			},
			times(val) {
				if(val){
					return val.split(" ")[0]
				}
				
			},
			addtrims(val) {
				if(val){
					if(val == "未上牌") {
					return val
					} else {
						let str1 = val.slice(0, 2)
						let str2 = val.slice(2, val.length)
						return str1 + " " + str2
					}
				}
				
			},
			numFilter(val) {
				// 截取当前数据到小数点后两位
				// let realVal = Number(val).toFixed(2)
				// num.toFixed(2)获取的是字符串
				// return Number(realVal)
				if((val || val == 0)&&val!="-") {
					val = val.toString().replace(/\$|\,/g, '');
					if(isNaN(val)) {
						val = "0";
					}
					let sign = (val == (val = Math.abs(val)));
					val = Math.floor(val * 100 + 0.50000000001);
					let cents = val % 100;
					val = Math.floor(val / 100).toString();
					if(cents < 10) {
						cents = "0" + cents
					}
					for(var i = 0; i < Math.floor((val.length - (1 + i)) / 3); i++) {
						val = val.substring(0, val.length - (4 * i + 3)) + ',' + val.substring(val.length - (4 * i + 3));
					}

					return(((sign) ? '' : '-') + val + '.' + cents);
				}else{
					return '-'
				}
			}

		},
		components: {
			ztreeSelect
		},
		methods: {
			//取消
			benfalse(){
				this.isshows=false	
			},
			btntrue(){
				let params={
					id:this.id,
				}
				this.btnloadings=true
				this.post(params,'services/app/guaranteeSlip/ActualRegister').then(res=>{
					console.log(8888)
					console.log(res)
					if(res.success){
						this.btnloadings=false
						    this.$confirm('', '登记成功', {
					          confirmButtonText: '查看详情',
					          cancelButtonText: '继续登记',
					          type: 'success',
					          showClose:false,
					          center: true
					        }).then(() => {
//					          this.$router.push({
//					            	name:"policyquery"
//					            })
//
								this.$router.push({
					            	name:"policydetail",
					            	params:{
					            		id:res.result.slipid
					            	}
					            })
								
					        }).catch(() => {
//					        	this.isshows=false
//					        	let obj={}
//					        	this.copyinfo=obj//Object.assign({}, obj);
								this.$router.replace({
									name:"policyNumber",
									query:{
										time:new Date().getTime()
									}
								})
					        	
					        });
						
//						 this.$notify({
//			              title: "保存成功",
//			              message: "您已成功保存",
//			              type: "success",
//			              customClass: "el-notification-success"
//			            });
			           
					}else{
						this.btnloadings=false
						this.$notify.error({
					        title: "保存失败",
					        message: res.error.message,
					        customClass: "el-notification-error"
					      });
					}
				})
			},
			//组织机构
			getUnits() {
				let params = {};
				this.post(params, "services/app/common/GetCurrentOrganizationUnits").then(
					rs => {

						if(rs.success) {
							let data = rs.result;
							let arr = [];
							arr.push(data);
							this.treedata = arr;

						}
					}
				);
			},
			setSelectedId(val) {

				if(val != "") {
					Vue.set(this.copyinfo, 'businessOrganzationId', "")
					this.getUsers(val)
				} else {
					Vue.set(this.copyinfo, 'businessOrganzationId', "")
					this.userlist = [];
				}

			},
			getUsers(val) {

				let params = {
					organzationId: val
				};
				this.post(params, "services/app/common/CurrentBusinessAscription").then(rs => {

					if(rs.success) {
						let result = rs.result.items;
						this.userlist = result;
						// this.formLabel.UserId=rs.result.items[0].organzationId
					}
				});
			},
			toPolicynumber() {
				this.$router.push({
					name: 'insentry1',
				})
			},
			toExcel() {
				this.$router.push({
					name: 'policyexcel',
				})
			},
			toPolicyhistory() {
				this.$router.push({
					name: "policyhistory"
				});
			},
			//更改公司
			changecomony(val) {
				Vue.set(this.copyinfo, "insuranceId", val);

				Vue.set(this.copyinfo, "staffId", '');

				this.getWorknumber();
			},
			//获取工号
			getWorknumber() {

				let params = {
					id: this.copyinfo.insuranceId
				};
				//Vue.set(this.copyinfo,"staffId",[])
				this.post(params, "services/app/common/GetCurrentInsuranceStaffs").then(
					res => {
						var arr = [];
						//this.workoptions
						arr = res.result.items;
						for(var i = 0; i < arr.length; i++) {
							if(arr[i].describe != "") {
								arr[i].staffAccount =
									arr[i].staffAccount + " (" + arr[i].describe + ")";
							} else {
								arr[i].staffAccount = arr[i].staffAccount;
							}
						}
						this.workoptions = arr;
					}
				);
			},
			//获取公司列表
			getcommoy() {
				let params = {};
				this.post(params, "services/app/common/GetGroupInsurances").then(res => {
					this.options = res.result.items;
				});
			},
			getallbasic(val) {

				var that = this
				let params = {
					id: val
				}
				that.post(params, "services/app/guaranteeSlip/ActualQueryGetCache").then(res => {
					if(res.success) {
						that.allData = res.result
						this.isshows = true
						this.loading1 = false
						this.getnames()
						//赋值-
						for(let k in that.allData) {
							if(that.allData[k] === null || that.allData[k] === "") {
								Vue.set(that.allData, k, "-")
							}
						}
						//保单关系人赋值-
						if(that.allData.guaranteeSlipRelations.length > 0) {
							that.allData.guaranteeSlipRelations.forEach(item => {
								for(let k in item) {
									if(item[k] === null || item[k] === "") {
										Vue.set(item, k, "-")
									}
								}
							})
						}
						// 扩展信息赋值-
						if(that.allData.guaranteeSlipAllExtends.length > 0) {
							that.allData.guaranteeSlipAllExtends.forEach(item => {
								for(let k in item) {
									if(item[k] === null || item[k] === "") {
										Vue.set(item, k, "-")
									}
								}
							})
						}

						//保单关系人

						let obj = that.allData.guaranteeSlipRelations
						let str = "";
						let arr = [];
						if(obj) {
							for(let i = 0; i < obj.length; i++) {
								arr = []
								if(obj[i].isApplicant) {
									arr.push('投保人')
								}
								if(obj[i].isCarOwner) {
									arr.push('车主')
								}
								if(obj[i].isInsurant) {
									arr.push('被保人')
								}
								str = arr.join("、")
								obj[i].str = str

							}
						}
					} else {
						this.loading1 = false
						this.$notify.error({
							title: "预览失败",
							message: res.error.message,
							customClass: "el-notification-error"
						});
					}

				})

			},
			getnames(){
			
				for(var i=0;i<this.userlist.length;i++){
					if(this.allData.salesmanOrganzationId==this.userlist[i].organzationId){
						this.allData.names=this.userlist[i].organzationName
					}
				}
			},
			btn(formName) {
				
				this.$refs[formName].validate(valid => {
					if(valid) {
						console.log(this.copyinfo)
						this.loading1 = true
						let params = {
							guaranteeSlipNumber: this.copyinfo.guaranteeSlipNumber,
							staffId: this.copyinfo.staffId,
							salesmanOrganzationId: this.copyinfo.businessOrganzationId,
							salesman: this.copyinfo.salesman
						}
						this.post(params, "services/app/guaranteeSlip/ActualQuerySetCache").then(res => {
							console.log(res)
							if(res.result.isSuccess) {
								console.log(res)
								this.id=res.result.querykey
								this.getallbasic(res.result.querykey)

							} else {
								this.isshows=false
								this.loading1 = false
								if(res.result.errorCode==200){
									this.$alert("该保单号已存在。请确认填写的保单号是否正确！", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==201){
									this.$alert("保单信息获取失败。请确认填写的保单号是否正确！", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==202){
									this.$alert("网络错误", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==207){
									this.$alert("验证码错误", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==300){
									this.$alert("保单信息获取失败。可能是以下原因： 1、网络不能正常链接，请检查网络链接情况；2、该保险公司更换了登录网址，请联系系统管理员；", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==203){
									this.$alert("工号错误", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else if(res.result.errorCode==208){
									this.$alert("保单信息获取失败。可能是工号信息发生修改，请联系系统管理员确认！", {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}else{
									this.$alert(res.result.errorMessage, {
										center: true,
										showClose: false,
										confirmButtonText: '确定',
										callback: action => {
	
										}
									});
								}

							}
						})

					} else {
						return false;
					}
				});
			},
		}
	}
</script>

<style lang='scss' scoped>

	.policynumber {
		.policynumber-tab {
			width: 100%;
			.tab-con {
				border-bottom: 1px solid #cbcbcb;
				span {
					width: 150px;
					line-height: 60px;
					height: 60px;
					display: inline-block;
					text-align: center;
					font-size: 16px;
					cursor: pointer;
					margin-bottom: -1px;
				}
				span:first-child {
					margin-left: 20px;
				}
				.active {
					color: #ee6000;
					background: url(../../assets/images/bomactive2x.png) center 51px no-repeat;
				}
			}
		}
		.layout1 {
			margin-left: 49px;
			margin-top: 30px;
			.form {
				float: left;
				width: 520px;
				.el-form-item__label {
					padding-right: 20px;
				}
				.el-input__inner {
					padding-left: 8px;
				}
				.el-textarea__inner {
					padding-left: 8px;
					width: 420px;
					height: 280px;
				}
				.inputbox {
					width: 420px;
					height: 28px;
				}
			}
			.notice {
				float: left;
				color: #555;
				margin-left: 90px;
				.notice1 {
					margin-top: 20px;
					font-size: 13px;
				}
			}
			.circle1 {
				color: #cf1322;
				font-size: 14px;
			}
			.circle {
				display: inline-block;
				width: 5px;
				height: 5px;
				border-radius: 50%;
				background-color: #cf1322;
				margin-right: 10px;
			}
		}
		.bottom {
			text-align: center;
			.btn1 {
				display: inline-block;
				margin-bottom: 37px;
			}
			.bdload {
				text-align: center;
			}
		}
	}
	
	.wd420 {
		width: 420px;
	}
	
	.contentin {
		width: 100%;
		padding: 0 20px;
		margin-top: 30px;
	}
	
	.btn {
		display: block;
		margin: 28px auto 20px;
	}
	
	.ruleFormout {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-around;
		.informationaa {
			width: 33.3%;
			.selects {
				width: 70%;
			}
		}
	}
	
	.contentdemo {
		padding: 0 82px;
		margin-bottom:70px;
		.contentdemoin {
			width: 100%;
			display: flex;
			background: #ffffff;
		}
	}
	
	.content_left {
		width: 100%;
		background: #ffffff;
		padding-bottom: 30px;
		.titles {
			width: 100%;
			height: 85px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: #FFFFFF;
			.title_name {
				font-size: 18px;
				color: #333333;
				i {
					color: #FF7819;
					margin-right: 15px;
				}
			}
			.top_btn {
				display: flex;
				align-items: center;
				.gobacks {
					width: 75px;
					height: 28px;
				}
				.btn_text {
					width: 75px;
					height: 28px;
					background: #FF7819;
					border-radius: 5px;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 13px;
					color: #FFFFFF;
					margin-left: 16px;
					cursor: pointer;
					i {
						font-size: 11px;
						margin-right: 8px;
					}
				}
			}
		}
		.Policy {
			width: 100%;
			box-sizing: border-box;
			background: #FFFFFF;
			box-shadow: -1px -1px 4px 0 rgba(0, 0, 0, 0.20), 1px 1px 4px 0 rgba(0, 0, 0, 0.20);
			border-radius: 5px;
			margin-bottom: 2px;
			padding: 0 0 30px 0;
			.Policy_top {
				width: 100%;
				height: 59px;
				border-bottom: 1px solid rgba(0, 0, 0, 0.2);
				display: flex;
				justify-content: flex-start;
				align-items: center;
				background: #ffffff;
				.Policy_top_name {
					font-size: 16px;
					color: #333333;
					margin-left: 30px;
					i {
						color: #027DCA;
						margin-right: 14px;
					}
				}
				.Policy_top_num {
					font-size: 17px;
					color: #0F62C2;
					margin-left: 10px;
				}
				.Policy_top_types {
					display: block;
					padding: 6px;
					background: #39b96c;
					border-radius: 3px;
					margin-left: 15px;
					font-size: 11px;
					color: #FFFFFF;
				}
				.Policy_top_type2 {
					display: block;
					padding: 6px;
					background: #3c8cbd;
					border-radius: 3px;
					margin-left: 15px;
					font-size: 11px;
					color: #FFFFFF;
				}
				.Policy_top_type {
					min-width: 95px;
					padding: 6px 12px;
					background-color: #0f62c2;
					border-radius: 5px;
					margin-left: 15px;
					border: 1px solid rgba(15, 98, 194, 0.50);
					box-shadow: 0 0 4px #fff inset;
					font-size: 13px;
					color: #FFFFFF;
					height: 30px;
					display: flex;
					justify-content: center;
					align-items: center;
				}
				.Policy_top_car {
					background: #0F62C2;
					color: white;
				}
				.Policy_top_car1 {
					background: #0F62C2;
					color: white;
				}
				.Policy_top_car2 {
					background: black;
					color: white;
				}
				.Policy_top_car3 {
					background: white;
					color: black;
				}
				.Policy_top_car4 {
					background: -webkit-linear-gradient(#dae6e2, #059067);
					/* Safari 5.1 - 6.0 */
					background: -o-linear-gradient(#dae6e2, #059067);
					/* Opera 11.1 - 12.0 */
					background: -moz-linear-gradient(#dae6e2, #059067);
					/* Firefox 3.6 - 15 */
					background: linear-gradient(#dae6e2, #059067);
					/* 标准的语法 */
					color: white;
				}
				.Policy_top_car5 {
					background: #ffd202;
					color: black;
				}
			}
			.Policy_top_nobor {
				border: 0;
			}
			.Policy_conebt {
				width: 100%;
				display: flex;
				justify-content: space-between;
				padding: 0 30px;
				background: #ffffff;
				.Policy_conebt_left {
					display: flex;
					flex-direction: column;
					width: 32%;
					.Policy_conebt_one {
						margin:0;
						padding:0;
						display: flex;
						justify-content: flex-start;
						margin-top: 14px;
						width: 100%;
						
						.Policy_conebt_name {
							min-width: 91px;
							font-size: 13px;
							color: #666666;
							display: block;
							line-height: 18px;
						}
						.Policy_top_smallname {
							width: 78px;
							min-width: 78px;
						}
						.Policy_conebt_dir {
							display: block;
							line-height: 18px;
							width: calc( 100% - 91px);
							font-size: 13px;
							color: #333333;
							word-break: break-all;
						}
						.Policy_conebt_money {
							color: #0F62C2;
							font-weight: 600;
						}
					}
					/*.Policy_conebt_one:not(:last-of-type){
						margin-bottom:12px;
					}*/
				}
				.Policy_conebt_left:not(:last-of-type) {
					margin-right: 2%;
				}
			}
			.Policy_table {
				width: 100%;
				padding: 0 30px;
				.Policy_table_top {
					width: 100%;
					height: 36px;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					border-top: 1px solid #E8E8E8;
					font-size: 13px;
					color: #333333;
					p {
						margin: 0;
						height: 100%;
						border-right: 1px solid #E8E8E8;
						display: flex;
						align-items: center;
						text-indent: 20px;
					}
					.Policy_table_one {
						width: 33%;
					}
					.Policy_table_two {
						width: 24%;
					}
					.Policy_table_twos {
						display: flex;
						justify-content: flex-end;
						padding-right: 20px;
					}
					.Policy_table_three {
						width: 25%;
					}
					.Policy_table_four {
						width: 18%;
						border-right: 0;
					}
				}
				.Policy_table_top:last-child {
					border-bottom: 1px solid #E8E8E8;
				}
				.Policy_table_tops {
					background: #FAEADA;
					border-top: 1px solid #E8E8E8!important;
					border-bottom: 1px solid #E8E8E8;
					p {
						border-right: 0;
					}
				}
			}
		}
		.Policy_arr:not(:last-of-type) {
			margin-bottom: 5px;
			box-shadow: 0 !important;
			border-radius: 0;
			border-bottom: 0;
		}
	}
	.Policy_boms {
		padding-top: 30px!important;
	}
		.Policy_details_name {
		border-bottom: 1px solid #E8E8E8;
		border-top: 1px solid #E8E8E8;
		font-size: 13px;
		color: #0F62C2;
		display: block;
		width: 100%;
		height: 37px;
		line-height: 37px;
		text-indent: 18.5px;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		.icon-xuanzhong {
			color: #FF7819;
			font-size: 9px;
			margin-right: 5px;
		}
	}
	.Policy_table_bor {
		border-left: 1px solid #E8E8E8;
		border-right: 1px solid #E8E8E8;
	}
		.Policy_extends {
		padding: 0!important;
		border: 0!important;
	}
	
	.extends {
		width: 100%;
		display: flex;
		justify-content: flex-start;
		flex-wrap: wrap;
		.extends_one {
			width: 50%;
			height: 47px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #E8E8E8;
			border-right: 1px solid #E8E8E8;
			.Policy_extends_one {
				
				text-indent: 30px;
			}
			.Policy_table_two {
				margin-right: 26px;
			}
		}
	}
	.fixedbtn{
		width:100%;
		height:72px;
		background: #f9f9f9;
		border-top: 1px solid  #999999;
		border-radius: 5px;
		position:fixed;
		bottom:0;
		left:0;
		display:flex;
		justify-content: center;
		align-items: center;
		padding-left:180px;
	}
	.debtn{
		width:110px;
		height:32px;
		margin-right:40px;
	}
	.hideSidebar .fixedbtn{
		padding-left:36px;
	}
	.nodata {
		width: 100%;
		padding: 20px 0;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>